/*
 * @lc app=leetcode.cn id=896 lang=rust
 *
 * [896] 单调数列
 */

// @lc code=start
impl Solution {
    pub fn is_monotonic(nums: Vec<i32>) -> bool {
        if nums.len() == 1{
            return true;
        }
        let mut greater = false;
        let mut less = false;
        for i in 1..nums.len() {
            if(nums[i] > nums[i - 1]){
                greater = true;
            }
            else if(nums[i] < nums[i - 1]){
                less = true;
            }
        }
        if greater && less {
            return false;
        }
        return true;
    }
}
// @lc code=end

